home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Vault: The Gold Collection
/
Software Vault - The Gold Collection (American Databankers) (1993).ISO
/
cdr30
/
hercb21.zip
/
HERCBIOS.DOC
< prev
next >
Wrap
Text File
|
1993-05-03
|
21KB
|
595 lines
***** _H_E_R_C_B_I_O_S *****
_B_I_O_S _E_N_H_A_N_C_E_M_E_N_T _F_O_R _T_H_E _H_E_R_C_U_L_E_S _B_O_A_R_D
Copyright Dave Tutelman 1988
All Rights Reserved
David M. Tutelman
16 Tilton Drive
Wayside, NJ 07712
(201) 922 - 9576
CONTENTS
1. GETTING STARTED
2. USING HERCBIOS FOR CGA EMULATION
2.1. What Programs Work?
2.2. Tuning for Performance
3. HERCULES BIOS PROGRAMMING
3.1. Hercules Modes
3.2. BIOS Functions
3.3. What Languages Work?
4. REGISTRATION & COPYING
HERCBIOS 2.1 10-31-88
- 2 -
The accompanying program is a front end to the INT 10 (VIDEO)
functions of the DOS BIOS, so that the important functions work
on a Hercules graphics board or its clones. It is a
terminate-and-stay-resident program, that is installed by being
called, say, from AUTOEXEC.BAT.
_1. _G_E_T_T_I_N_G _S_T_A_R_T_E_D
This program has several uses:
_E_m_u_l_a_t_i_o_n _o_f _t_h_e _C_G_A _b_o_a_r_d. There are many programs
available, especially games, that work with the IBM Color
Graphics Adapter but not with the Hercules. HERCBIOS
emulates the graphic modes 4, 5, and 6 of the CGA.
_P_r_o_g_r_a_m_m_i_n_g _g_r_a_p_h_i_c_s _a_p_p_l_i_c_a_t_i_o_n_s for the Hercules board.
HERCBIOS provides you with the standard BIOS functions for
handling pixels that the normal BIOS provides for the CGA.
It also provides the character-handling BIOS functions. Thus
it's easy to mix graphics and text on the screen.
_P_r_o_g_r_a_m_m_i_n_g _c_h_a_r_a_c_t_e_r _a_p_p_l_i_c_a_t_i_o_n_s _w_i_t_h _4_3 _l_i_n_e_s of
characters on the screen. HERCBIOS provides a mode in which
both graphics and small characters can be drawn.
To install HERCBIOS on your machine, run it as a command with the
appropriate options:
HERCBIOS [/Cn] [/Dn] [/Mnn]
/Cn, /Dn Tuning parameters for emulation
/Mnn Change the Hercules modes
The options are explained in the following sections. You can
include this line in your AUTOEXEC.BAT file, so that the BIOS is
installed whenever you boot your PC.
You will want to check out your machine with HERCBIOS after you
install it. Do this by running TESTPIX.EXE (included in this
distribution), with the video mode as the command line argument.
(E.g.- TESTPIX 8 to use Hercules mode 8.) Within TESTPIX,
pressing "Return" after each screen is drawn will make the
program go on to the next step.
HERCBIOS 2.1 10-31-88
- 3 -
_2. _U_S_I_N_G _H_E_R_C_B_I_O_S _F_O_R _C_G_A _E_M_U_L_A_T_I_O_N
HERCBIOS can run many graphics programs written for the CGA, even
some (not all) that don't use the BIOS for writing to the screen.
If the program uses the BIOS to set CGA graphics modes 4, 5, or
6, the BIOS set-mode call will turn on CGA emulation.
_2._1. _W_h_a_t _P_r_o_g_r_a_m_s _W_o_r_k?
Before the technical explanation, let's review a short list of
programs that are known either to work or not to work with
HERCBIOS.
_W_i_l_l _W_o_r_k _W_o_n'_t _W_o_r_k
BASICA Graphics (Microsoft) Jet (SubLogic)
Centipede (R.J.Grafe) Mean 18 (Accolade)
PrintMaster Hopper
Tick Attack (Pegasus) StarGate
Chess (Don Berg) Bricks (Vince Bly)
David's Kong Coins In A Box
Bert & the Snake (Piazza) Astro (Digital Marketing)
Even on those programs where it works, emulation still has its
limitations:
- The aspect ratio of the screen is not as tall as it should
be; we're using only 200 scan lines of the 348 on the
Hercules screen.
- Moving objects on the picture tends to "ghost" from one
place to another rather than "snap". It takes about a
quarter second for all the pixels of an object to move.
Tuning to improve the response is discussed in the next
section.
- It takes processing to run the emulation, reducing the
real-time available for the program to do its work. Some
programs will therefore run noticeably slower.
So what IS the criterion for whether a program will run under
emulation? It must not try to address the 6845 display controller
chip directly. It's all right for the program to access video RAM
directly, but the controller chip is off limits. Surprisingly,
about half the graphics programs I've tested seem to work,
indicating that they use the BIOS call to set the video mode and
don't check the retrace bit to avoid snow.
_2._2. _T_u_n_i_n_g _f_o_r _P_e_r_f_o_r_m_a_n_c_e
HERCBIOS accomplishes its emulation by refreshing the screen each
tick of the MS-DOS system clock (18.6 ticks per second). However,
it doesn't refresh all the pixels each tick; that would take more
than 100% of the processor's real time on a 4.77 MHz 8088.
Instead it refreshes about a quarter of the pixels each clock
HERCBIOS 2.1 10-31-88
- 4 -
tick. This divides the real time of a "vanilla" PC about half and
half between computing for the application and refreshing the
display. The result is a pair of visible performance
degradations: (1) the application runs at half speed, and (2) the
pixels of a moving object "ghost" after it, taking four ticks
(0.23 sec) to finish catching up with it.
It is possible to balance the processing between display and
computing, by calling HERCBIOS with command line arguments. You
can allocate more time to computing (/Cn) or to display (/Dn), by
some factor (n).
/_C_n - allocates more time to computing, by refreshing the
display only every nth clock tick (instead of every tick). n
can vary from 1 (the default) to 9. Example: /C4 refreshes
the display every 4/18.6 of a second, and only a quarter of
the pixels each time.
/_D_n - allocates more time to the display, by refreshing more
pixels each time refresh is done (normally every clock
tick). n can vary from 1 (the default) to 4. For n=4, all
the pixels are refreshed each tick. Example: /D2 refreshes
half the pixels 18.6 times a second.
If you aren't satisfied with the display performance on your
machine with your favorite programs, you should experiment with
different values of /C and /D. You don't need to reboot the
machine every time you change a tuning parameter; if HERCBIOS is
run again after it has already been installed, it will detect the
fact and just change the parameter value. That means that you
can, if you wish, use different tunings for different programs;
call the programs from a .BAT file that first calls HERCBIOS to
set the tuning values.
It is possible to set BOTH /C and /D, though I haven't found any
practical use for it. For instance, /C9 /D4 would compute for
half a second without updating the display, then snap all the
pixels to the current value.
HERCBIOS 2.1 10-31-88
- 5 -
_3. _H_E_R_C_U_L_E_S _B_I_O_S _P_R_O_G_R_A_M_M_I_N_G
HERCBIOS provides the programmer with most of the basic functions
one normally expects from a video BIOS. The only ones omitted
from the basic set (functions 0-15) are (1) set cursor size, (4)
get the light pen position, (8) read character and attribute from
screen, and (11) set color palette. Functions 1, 4, and 11 are
not relevant to the Hercules board, and function 8 is seldom used
and non-trivial to implement.
HERCBIOS intercepts all calls to Interrupt 10h, the video BIOS
interrupt. It determines (in a minimum of machine cycles) whether
it needs to handle the call; if not, it passes control to the ROM
BIOS. Those cases it needs to handle are;
- The current video mode is a native Hercules mode.
- The function requested is 0 - Set video mode.
_3._1. _H_e_r_c_u_l_e_s _M_o_d_e_s
The graphics modes recognized and processed by HERCBIOS are:
- _M_o_d_e _4 _o_r _5 - _C_G_A _m_e_d_i_u_m-_r_e_s _m_o_d_e: This invokes CGA
emulation, using a 640x200 portion of the 720x348 Hercules
raster to emulate the CGA board.
- _M_o_d_e _6 - _C_G_A _h_i_g_h-_r_e_s _m_o_d_e: This too invokes CGA emulation,
using a 640x200 portion of the 720x348 Hercules raster to
emulate the CGA board.
- _M_o_d_e _8 - _H_e_r_c_u_l_e_s _g_r_a_p_h_i_c_s _m_o_d_e: This uses the full
Hercules raster, with pixels addressible up to 720 by 348
and characters up to 90 by 29.
- _M_o_d_e _9 - _H_e_r_c_u_l_e_s _g_r_a_p_h_i_c_s _m_o_d_e, with closely-spaced
characters. This uses the full Hercules raster, with pixels
addressible up to 720 by 348 and characters up to 90 by 43.
I chose 8 and 9 for the Hercules modes because they seem unlikely
to conflict with other modes on a machine equipped with a
Hercules board. (Other displays that use modes 8 and 9 are the
PCJr and the Tandy 1000.) However, if you wish to reassign the
Hercules modes to some other values, use the /M option when you
install HERCBIOS. Two hex digits must follow the /M; they are the
mode (in hexadecimal) for Hercules graphics with 29 rows of
characters. The 43-row Hercules mode is one greater than the
29-row mode. For instance, the option /_M_6_D makes mode 6D (hex)
the 29-row mode and mode 6E the 43-row mode.
_3._2. _B_I_O_S _F_u_n_c_t_i_o_n_s
The functions implemented by HERCBIOS are:
HERCBIOS 2.1 10-31-88
- 6 -
Fn 0 - Set mode (4, 5, 6, 7, 8, or 9)
Fn 2 - Set cursor position
Fn 3 - Read cursor position
Fn 5 - New display page
Fn 6 - Scroll up
Fn 7 - Scroll down
Fn 9 - Write character with attribute
Fn 10 - Write character
Fn 12 - Write pixel
Fn 13 - Read pixel
Fn 14 - Teletypewriter-style character write
Fn 15 - Get video status
Check your System Programmers' Guide for the use of these BIOS
functions. HERCBIOS implements these functions faithfully, with
the following known specializations and exceptions:
- The Hercules board has enough RAM for two pages in graphics
mode, so HERCBIOS supports pages 0 and 1.
- Since attributes aren't stored in video RAM, we have to
cheat a little. The scrolling functions (6 and 7), in
setting the attribute for the "fill" lines, set pixels ON if
the attribute is 70 hex (reverse video) and OFF otherwise.
- For similar reasons, the "write character without
attribute" function (10) writes all characters using the
"normal" attribute, since it has no way of knowing the
present attribute. The "write character and attribute
function" (9) tries to mimic the behavior of character mode,
as detailed below.
- The Teletypewriter-style character write function (14)
ignores BL, since foreground color is meaningless on a
Hercules board.
When you use HERCBIOS to draw characters on the screen, remember
that a number of properties of the alphanumeric display are not
supported by the hardware when you enter graphics mode. For
instance, the cursor is not shown in graphics mode, and the
character attributes are not supported by the hardware. HERCBIOS
does its best to emulate the alphanumeric mode, but it cannot
implement a cursor or the blinking or bold attributes. The table
below shows the "best shot" that HERCBIOS takes at character
attributes:
HERCBIOS 2.1 10-31-88
- 7 -
_C_O_D_E _U_S_U_A_L_L_Y _M_E_A_N_S _H_E_R_C-_4_3 _M_O_D_E _H_E_R_C-_2_9 _M_O_D_E
00 invisible invisible invisible
01 underline [normal] underline
07 normal normal normal
0F hi-intens [rev video] [rev video]
70 rev video rev video rev video
Anything else displays as normal
_3._3. _W_h_a_t _L_a_n_g_u_a_g_e_s _W_o_r_k?
I have written programs using HERCBIOS in a number of languages.
Here are some of the caveats I'd like to pass on:
- Things are fine using INT 10h calls in assembler. (No big
surprise.)
- Similarly, programs written in a higher-level langauge that
have BIOS function calls (e.g.- "int86" in Turbo C and
Microsoft C) can make use of these BIOS routines. The
TESTPIX program included in this distribution is an example.
- Microsoft's BASICA and GWBASIC work in CGA emulation mode.
That means that you can write programs that call the
graphics screens, or run existing graphics programs from the
BASIC interpreter.
- Any language that writes to the standard output hangs the
machine if it triggers a scroll by writing off the bottom of
the screen; so do DOS and COMMAND.COM. This problem does not
arise with programs that use BIOS function 14 (TTY write) to
write off the bottom of the screen.
A significant example is the typical C compiler writing to
stdout; the behavior has been confirmed with Turbo C
(Version 1.0). Of course, you can write your own utility
functions to write to the screen using HERCBIOS functions.
The sample program packed with HERCBIOS includes HERCPIXL, a
one-file C "library" of such utilities.
- Borland's Turbo Pascal (Versions 1 and 2) behaves a bit
strangely when writing to the screen using the usual
functions (gotoxy, write, writeln). It works just fine,
except that it won't move the cursor out of the 80 x 25
character screen it knows about. (I haven't tested HERCBIOS
with more recent releases of Turbo Pascal.)
- The TESTPIX program was originally written in deSmet C 2.4.
It worked fine, with one caveat. The console I/O routine
_g_e_t_c_h_a_r() seems to write to display memory (perhaps as part
of keyboard echo). This can interfere with what is displayed
on the Hercules board display page 1. (I had no problems on
page 0.)
HERCBIOS 2.1 10-31-88
- 8 -
_R_E_G_I_S_T_R_A_T_I_O_N _A_N_D _C_O_P_Y_I_N_G
HERCBIOS is not in the public domain; it is shareware. It is
copyrighted by David M. Tutelman, who reserves all rights to the
program. You are permitted to use the program, with the following
restrictions.
_R_e_g_i_s_t_r_a_t_i_o_n:
If you find HERCBIOS useful, you are requested to register
your copy. The registration fee is $15. It entitles you to a
copy of the source code and the most recent distribution
version.
If you use HERCBIOS in your work, registration is mandatory,
not optional.
_C_o_p_y_i_n_g _a_n_d _D_i_s_t_r_i_b_u_t_i_o_n:
You may make copies of HERCBIOS for your own use.
You may distribute copies of HERCBIOS provided that:
- All the files in the original distribution are
included, unmodified and with their original names.
- No charge is made for the copy, above the actual cost
of media, packaging material, and postage or
communication charges.
You must have written permission from the author to make any
additional charge (for instance, a handling charge for your
labor, any charge to cover your inventory or overhead
expenses, or profit.) The author intends to be fairly
liberal in granting such permission, but asserts the right
to control commercial or semi-commercial distribution of his
work.
You may distribute HERCBIOS as part of a software package,
collection, or compilation, only if all the above
requirements are met for the package as a whole, and if no
compilation copyright is claimed on the collection.
You may not distribute modified versions or derivative works
of HERCBIOS without written permission from the HERCBIOS
author.
If you wish an exception from any provision of this license,
contact the author for written permission.
HERCBIOS 2.1 10-31-88
- 9 -
_R_E_L_E_A_S_E _H_I_S_T_O_R_Y _O_F _H_E_R_C_B_I_O_S
1.X 1984 through 1986
HERCBIOS had BIOS functions only. At least two postings
were made to USENET, and it found its way to various
bulletin boards. Some BB versions were corrupted (i.e. -
missing files).
2.0 8/88
Emulation capability added in November '86.
HERCBIOS "repackaged" to include emulation in summer '88,
and called HERCBIOS 2.0.
2.1 10/88 Bugfix Release
Character count in CX on Functions 9 & 10 fixed.
Graphic character table in INT 1F fixed.
HERCBIOS 2.1 10-31-88